package cn.zhz.service.provaider;

import cn.zhz.dao.provider.ProviderMapper;
import cn.zhz.pojo.Provider;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional
@Service
public class ProviderServiceImpl implements ProviderService {

    @Resource
    private ProviderMapper providerMapper;
    @Override
    public List<Provider> getProviderList(String proCode, String proName, int currentPageNo, int pageSize) {
        int beginIndex=(currentPageNo-1)*pageSize;
        return providerMapper.providerList(proCode,proName,beginIndex,pageSize);
    }

    @Override
    public int proCount(String proCode, String proName) {
        return providerMapper.proCount(proCode,proName);
    }

    @Override
    public List<Provider> list() {
        return providerMapper.list();
    }

    @Override
    public boolean addProvider(Provider provider) {
        return providerMapper.addProvider(provider)>0;
    }

    @Override
    public Provider viewProvider(int proid) {
        return providerMapper.viewProvider(proid);
    }

    @Override
    public boolean updateProivder(Provider provider) {
        return providerMapper.updateProvider(provider)>0;
    }

    @Override
    public int delProivder(int proid) {
        return providerMapper.delProvider(proid);
    }

    @Override
    public List<Provider> getAllProvider() {
        return providerMapper.getAllProvider();
    }


}
